This folder contains the grammars used in the evaluation portion of
the paper 'Graph parsing with s-graph grammars' by Groschwitz et al.,
ACL 2015.

The grammar with the "Bolinas" suffix can be used with the Bolinas
tool, available at http://www.isi.edu/publications/licensed-sw/bolinas.

The grammars with the "Alto" suffix can be used with the Alto tool,
available at https://bitbucket.org/tclup/alto.

The first line of the Alto versions specifies that we will use a graph
interpretation for our rules. The following rules all consist of two
parts: an RTG rule with terminal symbol l_1, l_2, ... and the value
h(l_i) of the homomorphism on that terminal symbol.

In the homomorphism, terms of the form "?number" are variables
(written x1, x2, ... in the paper). Expressions enclosed by '' are
constants. f_A denotes forget for the source name A, and r_A_B denotes
rename from A to B. 

If a nonterminal on the left hand side of a rule ever occurs with a
'!', then this indicates that it is a possible start nonterminal. Alto
uses as start states all graphs that are identical to the input graph
up to source assignments. In the given grammars, the multiple start
nonterminals correspond to the source names appearing in the start
state.

Alto can use the grammars to directly parse the graphs from the
"Little Prince" AMR-Bank
(http://amr.isi.edu/download/amr-bank-v1.4.txt). In order to apply the
Bolinas parser, the AMR-Bank must be converted into the Bolinas
format, which we did. In this translation process we converted all
node labels into unary hyperedges on the node. The Bolinas format for
graphs and rules is explained in the Bolinas documentation
(http://www.isi.edu/publications/licensed-sw/bolinas/).

'Grammar1Alto.txt' contains the grammar on which the experiment in
Fig. 5 is based. It was sampled from the graphs with up to 10 nodes in
the "Little Prince" dataset. The grammar makes use of three source
names and can therefore generate graphs of tree-width 2.

"Grammar2Bolinas.txt" and "Grammar2Alto.txt" contain the Bolinas and
Alto versions of the grammar on which the experiment in Fig. 6 is
based. This grammar was sampled from a selection of graphs with up to
8 nodes, and uses only two source names (for a tree-width of 1).
"Grammar2Bolinas.txt" is a translation of "Grammar2Alto.txt" into the
Bolinas grammar format.

The Bolinas version of Grammar 2 has four additional rules which are
necessary because Bolinas allows only a single starting nonterminal.
Therefore the first four rules simply introduce the two possible start
nonterminals of the IRTG. Except for this difference, there is a
one-to-one correspondence between the Bolinas and Alto rules, i.e. the
fifth rule in 'Grammar2Bolinas.txt' is the translation of the first
rule in 'Grammar2Alto.txt’, and so on.

